package com.zfy.cmsservice.service.impl;

import com.zfy.cmsservice.entity.CourseSelections;
import com.zfy.cmsservice.entity.vo.CourseSelectionVo;
import com.zfy.cmsservice.mapper.CourseSelectionsMapper;
import com.zfy.cmsservice.service.CourseSelectionsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zfy.commonutils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 选课表 服务实现类
 * </p>
 *
 * @author testjava
 * @since 2023-12-17
 */
@Service
public class CourseSelectionsServiceImpl extends ServiceImpl<CourseSelectionsMapper, CourseSelections> implements CourseSelectionsService {
    @Autowired
    private CourseSelectionsMapper courseSelectionsMapper;
    @Override
    public R pageCourseSelection(long page, long size, String courseId) {
        page = (page-1)*size;
        List<CourseSelectionVo> records = courseSelectionsMapper.pageCourseSelection(page,size,courseId);
        int total = courseSelectionsMapper.pageCourseSelectionTotal(page,size,courseId);
        return R.ok().data("total", total).data("content", records);
    }
}
